home *** CD-ROM | disk | FTP | other *** search
/ Resource Library: Multimedia / Resource Library: Multimedia.iso / maestro / tests / gtpnppst.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-06-15  |  1.1 KB  |  43 lines

  1. #include <stdio.h>
  2. #include <Sender.h>
  3. #include <Receiver.h>
  4.  
  5.  
  6. main(int argc, char** argv)
  7. {
  8.   Sender*    sender;
  9.   Receiver*    receiver;
  10.   Port        senderPort;
  11.   PortArray*    appList;
  12.   int        counter;
  13.  
  14.   printf("Starting the test.\n");
  15.   printf("Port number to connect to is %d.\n",PortMgrPortNumber);
  16.   senderPort.hostName = argv[1];
  17.   senderPort.portNumber = PortMgrPortNumber;
  18.   sender = NewSender(&senderPort);
  19.   receiver = NewReceiver(sender,argv[0],AnyPort);
  20.   printf("Connected with the Port Manager.\n");
  21.   SenderGetOpenApps(sender,&appList);
  22.   if (appList)
  23.     {
  24.       printf("Here is the list of apps currently registered with the Port Manager:\n");
  25.       for (counter = 0; counter < appList->numberOfPorts; counter++)
  26.     {
  27.       printf("%d. Name: %s \t Host: %s \t Port: %d\n",
  28.          counter+1,
  29.          appList->portArray[counter].appName,
  30.          appList->portArray[counter].hostName,
  31.          appList->portArray[counter].portNumber);
  32.     }
  33.       printf("Done printing the list of apps.\n");
  34.     }
  35.   else
  36.     {
  37.       printf("No apps currently open.\n");
  38.     }
  39.   printf("Got list of open apps. Exiting.\n");
  40.   DestroyReceiver(sender, receiver);
  41.   exit(0);
  42. }
  43.